package com.zl.tby.screen.controller;

import com.zl.tby.core.common.R;
import com.zl.tby.dto.TbyCameraInfoQuery;
import com.zl.tby.dto.TbyResearchActivitiesQuery;
import com.zl.tby.model.TbyCameraInfo;
import com.zl.tby.screen.service.ITbyEducationScreenService;
import com.zl.tby.screen.vo.education.TbyActivitiesStatisticBean;
import com.zl.tby.screen.vo.education.TbyAnimalPlantViewStatistic;
import com.zl.tby.screen.vo.education.TbyCameraStatisticBean;
import com.zl.tby.screen.vo.education.TbyEducationResourceScreenBean;
import com.zl.tby.service.ITbyCameraInfoService;
import org.noear.solon.annotation.Body;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.core.handle.MethodType;
import org.noear.solon.validation.annotation.Valid;

import java.util.List;

/**
 * 科研宣教-大屏-控制器
 * @author changpeng
 * @version 1.0
 * @since 2024/8/15 15:31
 */
@Valid
@Controller
@Mapping("/education")
public class TbyEducationScreenController {

    @Inject
    private ITbyEducationScreenService tbyEducationScreenService;
    @Inject
    private ITbyCameraInfoService tbyCameraInfoService;

    /**
     * 左上-红外相机监测统计
     * @return 结果
     */
    @Mapping(value = "/camera_statistic", method = MethodType.GET)
    public R<TbyCameraStatisticBean> cameraStatistic() {
        return R.ok(tbyEducationScreenService.cameraStatistic());
    }

    /**
     * 获取全部相机
     * @return 相机列表
     */
    @Mapping(value = "/camera_list", method = MethodType.GET)
    public R<List<TbyCameraInfo>> cameraInfoList() {
        return R.ok(this.tbyCameraInfoService.list(new TbyCameraInfoQuery()));
    }

    /**
     * 物种拍摄排行榜
     * @param limit：获取数量
     * @return 结果
     */
    @Mapping(value = "/animal_plant_shop_order", method = MethodType.GET)
    public R<List<TbyAnimalPlantViewStatistic>> animalPlantShopOrder(Integer limit) {
        return R.ok(tbyEducationScreenService.animalPlantShopOrder(limit));
    }

    /**
     * 科研统计
     * @param query: 查询参数
     * @return 结果
     */
    @Mapping(value = "/activities_statistic", method = MethodType.GET)
    public R<List<TbyActivitiesStatisticBean>> activitiesStatistic(@Body TbyResearchActivitiesQuery query) {
        return R.ok(tbyEducationScreenService.activitiesStatistic(query));
    }

    /**
     * 自然教育资源统计
     * @return 结果
     */
    @Mapping(value = "/education_resource_statistic", method = MethodType.GET)
    public R<TbyEducationResourceScreenBean> educationResourceStatistic() {
        return R.ok(tbyEducationScreenService.educationResourceStatistic());
    }

    /**
     * 自然教育人才培养
     * @return 结果
     */
    @Mapping(value = "/education_person_train", method = MethodType.GET)
    public R<TbyEducationResourceScreenBean> educationPersonTrain(@Body TbyResearchActivitiesQuery query) {
        return R.ok(tbyEducationScreenService.educationPersonTrain(query));
    }
}
